from utils import *

phrase = get_phrase()
if not check_video_folder(phrase):
    perror('folder dont exist, please check the phrase')
    sys.exit()

full_path = concat_phrase(phrase)
if if_file_exists(f'{full_path}/translate.txt'):
    perror('translate.txt already exists')
    sys.exit()

# ask if I want to enter translation, and each time input oneline, then put them in an array
translations = []
while True:
    translation = input('Enter translation: ')
    if not translation:
        break
    translations.append(translation)

# write to translate.txt
with open(f'{full_path}/translate.txt', 'w') as f:
    # iterate translations and give numbers to each line starting from 1 and concat them with \n to write into the file
    for i, translation in enumerate(translations):
        f.write(f'{i+1}. {translation}\n')

psuccess('translate.txt created')
